package acidcart.client;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
//import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class LoginView extends Composite  {

	private final Button loginButton;
	private final Button signupButton;
	private final FlexTable loginTable;
	private final TextBox usernameTextBox;
	private final PasswordTextBox passwordTextBox;
	
	public LoginView()
	{
	    //DecoratorPanel decorator = new DecoratorPanel();
	    //initWidget(this); //decorator
	    //decorator.setWidth("100%");
	    //decorator.setHeight("60px");
	    
	    loginTable = new FlexTable();
	    loginTable.setHeight("60px");
	    usernameTextBox = new TextBox();
	    passwordTextBox = new PasswordTextBox();
	    signupButton = new Button("Sign-up");
	    loginButton = new Button("Login");
	    loginTable.setWidget(0, 0, new Label("User Name:"));
	    loginTable.setWidget(0, 1, usernameTextBox);
		loginTable.setWidget(1, 0, new Label("Password:"));
		loginTable.setWidget(1, 1, passwordTextBox);		
		loginTable.setWidget(2, 0, signupButton);
		loginTable.setWidget(2, 1, loginButton);
		usernameTextBox.setFocus(true);
		
		
		initWidget(loginTable);
		//decorator.add(loginTable);
	}
	
	public HasValue<String> getUserNameTextBox() {
		return usernameTextBox;
	}
	public HasValue<String> getPasswordTextBox() {
		return passwordTextBox;
	}
	public HasClickHandlers getLoginButton() {
		return loginButton;
	}
	public HasClickHandlers getSubmitbutton() {
		return signupButton;
	}
	public Widget asWidget() {
		return this;
	}
}
